<?php
/**
 * Created by PhpStorm.
 * User: hanbin
 * Date: 17/4/11
 * Time: 下午9:43
 */

namespace App\Logic;


use App\Server\FileUrlModel;

class PublicLogic extends BaseLogic
{
    /**
     * 轮播图
     * @return array
     */
    public static function banner($type = 2)
    {
        $detail = FileUrlModel::getList(10, null, 1, ['is_delete' => 0, 'type' => $type]);
        if ($detail) {
            $list = $detail['data'];
            if ($list) {
                $result = [];
                foreach ($list as $k => $v) {
                    $item = [];
                    $item['id'] = $v['id'];
                    $item['file_url'] = $v['file_url'];
                    $item['related_id'] = $v['related_id'];
                    $result[] = $item;
                }
                $detail['data'] = $result;
            }
        }
        return self::success($detail, 200, 'ok');
    }

}